<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/fs-test-util.js"></script>
</head>
<body>
<script>
description('This test tries calling various filesystem functions with null arguments.');

function errorCallback(error)
{
    debug("Error occurred: " + error.name);
    finishJSTest();
}

function successCallback(fs)
{
    window.fileSystem = fs;
    debug("Successfully obtained FileSystem: " + fileSystem.name);

    shouldThrow("fileSystem.root.moveTo(null)");
    shouldThrow("fileSystem.root.copyTo(null)");
    fileSystem.root.getFile("/test", { create: true }, function(entry) {
        entry.createWriter(function(writer) {
            window.writer = writer;
            shouldBeNull("writer.error");
            shouldThrow("writer.write(null)");
            shouldBeNull("writer.error");
            removeAllInDirectory(fileSystem.root, finishJSTest, finishJSTest);
        });
    });
}

if (window.webkitRequestFileSystem) {
    webkitRequestFileSystem(window.TEMPORARY, 100, successCallback, errorCallback);
    window.jsTestIsAsync = true;
} else {
    debug("This test requires FileSystem API support.");
}
</script>
</body>
</html>
